#!/bin/bash
# set -x 
now=$(date +"%Y%m%d_%H%M%S")
method='unimatch'

# modify these augments if you want to try other datasets, splits or methods
# dataset: ['pascal', 'cityscapes', 'coco']
# method: ['unimatch', 'fixmatch', 'supervised']
# exp: just for specifying the 'save_path'
# split: ['92', '1_16', 'u2pl_1_16', ...]. Please check directory './splits/$dataset' for concrete splits
# dataset='cityscapes'
# split='1_16'
dataset='pascal'
split='92'

config=$1
filename=$(basename "$config")
exp="${filename%.*}"
echo "exp is $exp"
labeled_id_path=splits/$dataset/$split/labeled.txt
unlabeled_id_path=splits/$dataset/$split/unlabeled.txt
save_path=exp/$dataset/$method/$exp/$split

mkdir -p $save_path
echo "use gpu $CUDA_VISIBLE_DEVICES"

# python -m torch.distributed.launch \
#     --nproc_per_node=2 \
#     --master_addr=localhost \
#     --master_port=$MASTER_PORT \
#     $method.py \
#     --config=$config --labeled-id-path $labeled_id_path --unlabeled-id-path $unlabeled_id_path \
#     --save-path $save_path --port $MASTER_PORT 2>&1 | tee $save_path/$now.log
# accelerate launch \
#     $method.py \
#     --config=$config --labeled-id-path $labeled_id_path --unlabeled-id-path $unlabeled_id_path \
#     --save-path $save_path >&1 | tee $save_path/$now.log


python \
    $method.py \
    --config=$config --labeled-id-path $labeled_id_path --unlabeled-id-path $unlabeled_id_path \
    --save-path $save_path >&1 | tee $save_path/$now.log


